<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>如何使用EL表达式从域对象中取值简化取值写法</title>
</head>
<body>

<%
    pageContext.setAttribute("pc", "pageContext");
    request.setAttribute("request", "request");
    request.setAttribute("pc", "requestscope");
    session.setAttribute("session", "session");
    application.setAttribute("application", "application");
%>

<%--
    ${} EL表达式   EL表达式可以从四大域对象中获取指定key的值
    如何从域对象中取值？  key
    取值顺序  pageContext  -> request ->  session -> application

   指定作用域进行取值操作
   pageScope    requestScope    sessionScope  applicationScope

--%>
<h1>获取域对象中的值</h1>
<p>pageContext:${pc}</p>
<p>request:${request}</p>
<p>request-pc:${pc}</p>
<p>session:${session}</p>
<p>application:${application}</p>

<h1>获取指定域对象中的值</h1>
<p>pageContext:${pageScope.pc}</p>
<p>request-pc:${requestScope.pc}</p>
<p>session:${sessionScope.session}</p>
<p>application:${applicationScope.application}</p>

</body>
</html>
